package com.wangzaiplus.test.juc.thread;

/**
 * @ClassName Demo09
 * @Description: TODO
 * @Author wgc
 * @Date 2020/06/28 10:52
 * @Version V1.0
 **/
public class Demo09 {


    public static  volatile  boolean flag = true;

    public  static  class T1 extends  Thread{
        public  T1(String name){
            super.run();
        }
        @Override
        public void run() {
            System.out.println("线程"+this.getName()+" in ");
            while(flag){
                ;
            }
            System.out.println("线程"+this.getName()+" stop ");
        }
    }

    public static void main(String[] args) throws InterruptedException {
       new T1("T1").start();
       Thread.sleep(1000);
       flag=false;
    }
}
